package core.view.dirlist
{
	import core.model.ConfigData;
	
	import org.ais.event.TEvent;
	import org.ais.system.Ais;
	import org.aisy.display.USprite;
	import org.aisy.ulist.UList;
	import org.aisy.ulist.UListEvent;

	public class DirListView extends USprite
	{
		static protected var instance:DirListView;
		
		public function DirListView()
		{
			init();
		}
		
		protected function init():void
		{
			var _ulist:UList = new UList();
			_ulist.setLabel(DirUListLabel, ConfigData.configData.list[0]);
			_ulist.setListItem(DirUListItem);
			_ulist.setListData(ConfigData.configData.list);
			_ulist.initializeView();
			_ulist.getScroll().setSize(_ulist.getListoy().width, Ais.IMain.stage.stageHeight);
			addChild(_ulist);
			
			var _w:Number = 0;
			var _h:Number = 0;
			var f:Function = function (w:Number, h:Number):void
			{
				_w = Math.max(_w, w);
				_h = Math.max(_h, h);
			};
			
			TEvent.trigger(_ulist.NAME + "ITEM", "GET_WIDTH_HEIGHT", f);
			TEvent.trigger(_ulist.NAME + "ITEM", "SET_WIDTH_HEIGHT", [_w, _h]);
			TEvent.trigger(_ulist.NAME + "ITEM", UListEvent.RADIO_SELECT, 0);
		}
	}
}